<?php
$this->pageTitle=Yii::app()->name . ' - Login';
// $show=Tools::is3G();
$show='';
?>
<div class="title_mod">
	<a href="#" title="Login"><span class="mleft"><span class="mright">Đăng nhập</span></span></a>
</div>
<div class="form">
<div class="row buttons">
<?php if($show=='viettel' || $show=='mobi'):?>
<?php 
			$Session= new Session('Script');
			$Session->set('fs',time());
			$Session->set('id',time());
			$appid=Yii::app()->params['applicationId'];
			$appsecret=Yii::app()->params['appSecret'];
			$p=$Session->Get('id');
			$s=$Session->Get('fs');
			$md5=md5($appid.$p.$appsecret.$s);
			$link=Yii::app()->params['paymentUrl'].'?a='.$appid.'&p='.$p.'&s='.$s.'&md5='.$md5;
?>
<p>Nếu bạn chưa có tài khoản. Hãy <?php echo CHtml::link('Đăng ký',$link,array('title'=>'Đăng ký','class'=>'button-get')); ?></p>
<?php else:?>
<div style="text-align: justify;">
<?php if(isset($package)){echo $package->desc;}?>
</div>
<?php endif;?>

</div>
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'login-form',
	'enableClientValidation'=>true,
	'clientOptions'=>array(
		'validateOnSubmit'=>true,
	),
)); ?>
	<div class="row">
		<label>Số Thuê bao</label>
		<?php echo $form->textField($model,'username'); ?>
		<?php echo $form->error($model,'username'); ?>
	</div>
	<div class="row">
		<label>Mật khẩu</label>
		<?php echo $form->passwordField($model,'password'); ?>
		<?php echo $form->error($model,'password'); ?>
	</div>

	<div style="display: none;" class="row rememberMe">
		<?php echo $form->checkBox($model,'rememberMe',array('checked'=>'checked')); ?>
		<?php echo $form->label($model,'rememberMe'); ?>
		<?php echo $form->error($model,'rememberMe'); ?>
	</div>
	<div class="row buttons">
		<?php echo CHtml::submitButton('Đăng nhập'); ?>
	</div>
	<?php
	    foreach(Yii::app()->user->getFlashes() as $key => $message) {
	        echo '<div class="flash-' . $key . '">' . $message . "</div>\n";
	    }
	?>
<?php $this->endWidget(); ?>
</div><!-- form -->
<script type="text/javascript">
$(document).ready(function() {
	$('.form').css('min-height',($(window).height()-117-167)+'px');
	var canDetect = "onorientationchange" in window; 
	var orientationTimer = 0; 
	$(window).bind(canDetect ? "orientationchange" : "resize", function(evt) { 
	   clearTimeout(orientationTimer); 
	   orientationTimer = setTimeout(function() {
		   $('.form').css('min-height',($(window).height()-117-167)+'px');
	  }, 500); 
	});
});
</script>